home *** CD-ROM | disk | FTP | other *** search
- /****************************************************************************************************
- 6/96 bob Updated #includes to support changed GX Library names.
-
- ©1990 - 1996 Apple Computer, Inc.
- All rights reserved.
- ****************************************************************************************************/
- #include <Types.h>
- #include <QuickDraw.h>
- #include <Fonts.h>
- #include <Windows.h>
- #include <Menus.h>
- #include <SegLoad.h>
- #include <Memory.h>
- #include <Desk.h>
-
- #include <GXGraphics.h>
- #include "GraphicsLibraries.h"
- #include <GXEnvironment.h>
-
- #include <GXTypes.h>
- #include <GXLayout.h>
- #include "LayoutLibrary.h"
-
- #include "SampleInterface.h"
-
- short MyStrLen(char *x);
- static short MyStrLen(x)
- char *x;
- {
- short c = 0;
- while (*x++) c++;
- return c;
- } /* MyStrLen */
-
- void UnicodeReordering(WindowPtr sampleWindow)
- {
- /* Variables */
- char *myString = "ABCDEFGHIJ";
- gxLayoutOptions gxLayoutOptions;
- gxPoint myPoint;
- gxRunControls gxRunControls;
- gxShape layout;
- short i, len, level = 0, runLengths[5], runLevels[5];
- gxStyle reversedStyle, romanStyle, styleArray[5];
- gxViewPort aViewPort;
-
- /* Initialization */
-
- myPoint.x = ff(30);
- myPoint.y = ff(50);
-
- aViewPort = GXNewWindowViewPort(sampleWindow);
- SetDefaultViewPort(aViewPort);
-
- len = MyStrLen(myString);
- for (i = 0; i < 5; i++) runLengths[i] = 2;
-
- romanStyle = NewLayoutStyle((char *) "\pHoefler Text", ff(50), 0, nil, nil, 0, nil);
-
- InitializeRunControls(&gxRunControls);
- gxRunControls.flags = gxImposeRightToLeft;
- reversedStyle = NewLayoutStyle(
- (char *) "\pZapf Chancery Medium Italic", ff(50), 0, &gxRunControls, nil, 0, nil);
-
- styleArray[0] = styleArray[2] = styleArray[4] = romanStyle;
- styleArray[1] = styleArray[3] = reversedStyle;
-
- layout = GXNewLayout(
- 1, &len, (void *) &myString,
- 5, runLengths, styleArray,
- 1, &len, &level,
- nil, &myPoint);
- GXDrawShape(layout);
-
- InitializeLayoutOptions(&gxLayoutOptions);
- gxLayoutOptions.flags = gxImposeLeftToRight;
- level = 1;
- GXSetLayout(layout, 0, nil, nil, 0, nil, nil, 1, &len, &level,&gxLayoutOptions, nil);
- GXMoveShape(layout, 0, ff(75));
- GXDrawShape(layout);
-
- runLevels[0] = runLevels[4] = 0;
- runLevels[1] = runLevels[2] = runLevels[3] = 1;
- GXSetLayout(layout, 0, nil, nil, 0, nil, nil, 5, runLengths, runLevels, nil, nil);
- GXMoveShape(layout, 0, ff(75));
- GXDrawShape(layout);
-
- GXDisposeShape(layout);
- GXDisposeStyle(romanStyle);
- GXDisposeStyle(reversedStyle);
- GXDisposeViewPort(aViewPort);
- } /* main */
-